<%@page import="myuser.UserDao"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<%@ page import="myuser.*" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="jq/jquery-1.11.1.js"></script>
<script type="text/javascript">
$(function(){
	$(".deleteuser").click(function(){
		$(this).each(function(i, e) {
           if(!confirm("您确定要删除["+e.lang+"]用户吗？")){
			 	return;
			}; 
			$.post("user.do?op=delete",{userName:e.lang,pwd:""},function(){
				location.href("userlist.jsp");
					
			});   
        });;	
	});
	$(".modifyuser").each(function(i, e) {
		$(this).click(function(){
			location.href("modify.jsp?id="+e.lang);	
		});       
    });;
});
</script>
</head>
<body>
显示列表<br/><br/>
<%
	pageContext.setAttribute("list", new UserDao().getusers());
%>
<table class="bordered">
<tr><td>序号</td><td>用户名</td><td>密码</td><td>删除</td><td>修改</td></tr>
<logic:iterate id="u" name="list" indexId="index">
	<tr>
        <td>${index+1 }</td>
		<td>${u.userName }</td>
		<td>${u.pwd }</td>
        <td><a href="#" class="deleteuser" lang="${u.userName }">删除</a></td>
        <td><a href="#" class="modifyuser" lang="${u.id }">修改</a></td>
	</tr>
</logic:iterate>

</table>
<br/><br/>
<a href="main.jsp">返回主页面</a>
</body>
</html>